package fixmodel.factory;

import fixmodel.adapter.GooseAdapter;
import fixmodel.base.Quack;
import fixmodel.decor.QuackCounter;
import fixmodel.entity.Goose;
import fixmodel.impl.DuckCall;
import fixmodel.impl.MallardDuck;
import fixmodel.impl.RedHeadDuck;
import fixmodel.impl.RubberDuck;

/**生产具有计数功能的鸭子的工厂
 * @author yaojianfeng
 */
public class CountingDuckFactory extends AbstractDuckFactory{
    /**
     * 创建绿头鸭
     *
     * @return 绿头鸭
     */
    @Override
    public Quack creatMallardDuck() {
        return new QuackCounter(new MallardDuck());
    }

    /**
     * 创建红头鸭
     *
     * @return 红头鸭
     */
    @Override
    public Quack creatRedHead() {
        return new QuackCounter(new RedHeadDuck());
    }

    /**
     * 创建鸭鸣器
     *
     * @return 鸭鸣器
     */
    @Override
    public Quack creatDuckCall() {
        return new QuackCounter(new DuckCall());
    }

    /**
     * 创建橡皮鸭
     *
     * @return 橡皮鸭
     */
    @Override
    public Quack creatRubberDuck() {
        return new QuackCounter(new RubberDuck());
    }

    /**
     * 创建大鹅对象
     *
     * @return 大鹅
     */
    @Override
    public Quack creatGoose() {
        return new QuackCounter(new GooseAdapter(new Goose()));
    }
}
